﻿#pragma once

#include "../MonsterObject.h"
#include "../ConquestObject.h"
#include "BlockingObject.h"
#include "../../MirDatabase/MonsterInfo.h"
#include "../../../Shared/Enums.h"
#include "../PlayerObject.h"
#include "../../../Shared/Packet.h"
#include <string>
#include <vector>

using namespace Server::MirDatabase;
using namespace Server::MirEnvir;
namespace S = ServerPackets;

namespace Server::MirObjects::Monsters
{
    class CastleGate : public MonsterObject
    {
    public:
        ConquestObject *Conquest;
        int GateIndex = 0;

        bool Closed = false;
    private:
        long long CloseTime = 0;

        bool AutoOpen = true;

    protected:
        std::vector<BlockingObject*> BlockingObjects = std::vector<BlockingObject*>();

        std::vector<Point*> BlockArray;

    public:
        virtual ~CastleGate()
        {
            delete Conquest;
        }

    protected:
        bool getCanAttack() const override;

        bool getCanMove() const override;
    public:
        bool getBlocking() const override;

    protected:
        CastleGate(MonsterInfo *info);


    public:
        void Spawned() override;
    protected:
        void ProcessAI() override;

        void ProcessSearch() override;


    public:
        void Turn(MirDirection dir) override;

        bool Walk(MirDirection dir) override;

        bool IsAttackTarget(MonsterObject *attacker) override;
        bool IsAttackTarget(PlayerObject *attacker) override;

    protected:
        void ProcessRoam() override;

    public:
        Packet *GetInfo() override;

        void Die() override;

        int Attacked(PlayerObject *attacker, int damage, DefenceType type = DefenceType::ACAgility, bool damageWeapon = true) override;

    protected:
        virtual int GetDamageLevel() = 0;

    public:
        virtual void OpenDoor() = 0;

        virtual void CloseDoor() = 0;

        virtual void RepairGate() = 0;

    protected:
        virtual void ActiveDoorWall(bool closed);

    };
}
